package com.gavindon.android.view.video

import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.*
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.fragment.app.DialogFragment
import com.gavindon.android.R
import com.gavindon.android.utils.phoneHeight
import com.gavindon.android.utils.phoneWidth

/**
 * description:
 * Created by liNan on  2022-4-12 19:50
 */
class IntroMoreDialog(private val content: String) : DialogFragment() {


    private lateinit var tvIntroduce: TextView
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setStyle(STYLE_NORMAL, R.style.halfDialog)
    }

    override fun onStart() {
        super.onStart()
        dialog?.window?.setWindowAnimations(R.style.RightAnimation)
        dialog?.window?.setLayout(phoneWidth / 3, phoneHeight)
        dialog?.window?.setBackgroundDrawable(
            ContextCompat.getDrawable(
                this.requireContext(),
                R.drawable.intro_more_shape
            )
        )
        dialog?.window?.setGravity(Gravity.END)
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val view = inflater.inflate(R.layout.dialog_intro_more, container, false)
        tvIntroduce = view.findViewById(R.id.dialog_intro_content)
        return view
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        tvIntroduce.text = content
    }

}